package com.aizuda.boot.modules.system.entity.dto;

import com.aizuda.boot.modules.common.constant.enums.ContractScopeTypeEnums;
import com.aizuda.boot.modules.common.constant.enums.DataType;
import com.aizuda.boot.modules.common.constant.enums.PermissionStatusType;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Author sangyirong
 * @ClassName SysRoleDetailDTO
 * @Version 1.0
 * @Date 2025/7/2 10:32
 */
@Data
@NoArgsConstructor
@Schema(description = "角色详情")
public class SysRoleDetailDTO extends SysRoleDTO {


    @Schema(description = "操作权限")
    private Map<String, Map<String, Object>> operatePermission;

    @Schema(description = "数据权限")
    private List<DataPermission> dataPermissions;

    @Schema(description = "成员配置")
    private List<Member> members;


    @Data
    @NoArgsConstructor
    @Schema(description = "数据权限")
    public static final class DataPermission {

        @Schema(description = "数据权限ID")
        private Long id;

        @Schema(description = "数据权限名称")
        private String name;

        @Schema(description = "数据权限类型")
        private DataType type;

        @Schema(description = "数据权限范围")
        private ContractScopeTypeEnums scope;

        @Schema(description = "数据权限有效期")
        private String validityType;

        @Schema(description = "数据权限状态")
        private PermissionStatusType status;

        @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
        @Schema(description = "数据权限有效期开始时间")
        private Date startDate;

        @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
        @Schema(description = "数据权限有效期结束时间")
        private Date endDate;
    }

    @Data
    @NoArgsConstructor
    @Schema(description = "成员配置")
    public static final class Member {

        @Schema(description = "用户ID")
        private Long userId;

        @Schema(description = "用户名称")
        private String name;

        @Schema(description = "员工名称")
        private String employeeName;

        @Schema(description = "用户名")
        private String userName;

        @Schema(description = "头像")
        private String avatar;

        @Schema(description = "部门名称")
        private String deptName;

        @Schema(description = "是否全部部门")
        private Boolean departmentAll;

        @Schema(description = "部门ID列表")
        private List<Long> departmentIds;

        @Schema(description = "部门名称列表")
        private String departmentNames;

        @Schema(description = "是否全部城市")
        private Boolean cityAll;

        @Schema(description = "城市列表")
        private List<String> cities;
    }
}
